Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Determining What Kind of Tracks a Component Supports

The following code sample can be used to determine which track types a given movie export component supports.

Listing 2 Determining What Track Types a Movie Export Component Supports

QTAtomContainer container = nil;
ComponentDescription cd;
long count, i;

cd.componentType = MovieExportType;
cd.componentSubType = 0;
cd.componentManufacturer = 0;
cd.componentFlags = 0;
cd.componentFlagsMask = 0;

GetComponentPublicResourceList(kQTMovieExportTrackInfoResourceType, 1, 0, &cd, nil, nil,
&container);

count = QTCountChildrenOfType(container, kParentAtomIsContainer, OSTypeConst('comp'));
for (i=1; i<=count; i++) {
    QTAtom compAtom, trkResourceAtom;
    Component c;

    compAtom = QTFindChildByIndex(container, kParentAtomIsContainer, OSTypeConst('comp'), i,
(long *)&c);
    trkResourceAtom = QTFindChildByID(container, compAtom,
kQTMovieExportTrackInfoResourceType, 1, nil);
    if (trkResourceAtom) {
        QTMovieExportSourceRecord **trkResource = (QTMovieExportSourceRecord **)NewHandle(0);
        long j;
        Boolean wantsSound = false, wantsVideo = false, wantsText = false, wantsMIDI = false;

        QTCopyAtomDataToHandle(container, trkResourceAtom, (Handle)trkResource);
        for (j=0; j<(**trkResource).count; j++) {
            OSType mType = (**trkResource).sourceArray[j].mediaType;
            long flags = (**trkResource).sourceArray[j].flags;

            wantsSound = wantsSound ||
                        ((mType == SoundMediaType) && (flags &
kQTMovieExportSourceInfoIsMediaType));
            wantsVideo = wantsVideo ||
                        (((mType == VideoMediaType) && (flags &
kQTMovieExportSourceInfoIsMediaType)) ||
                        ((mType == VisualMediaCharacteristic) && (flags &
kQTMovieExportSourceInfoIsMediaCharacteristic)));
            wantsText = wantsText ||
                        ((mType == TextMediaType) && (flags &
kQTMovieExportSourceInfoIsMediaType));
            wantsMIDI = wantsMIDI ||
                        ((mType == MusicMediaType) && (flags &
kQTMovieExportSourceInfoIsMediaType));
        }

        if (wantsSound || wantsVideo) {
            ComponentDescription cd;
            char cc[5];

            GetComponentInfo(c, &cd, nil, nil, nil);
            cc[0] = 4;
            *(long *)&cc[1] = cd.componentSubType;
            DebugStr((StringPtr)cc);
            
        }

        DisposeHandle((Handle)trkResource);
    }
}

QTDisposeAtomContainer(container);


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |